Add moments collection + Mnemosyne sync workflow#4
Open
trustbutverafy wants to merge 1 commit into
Open
Conversation
Introduces a new `_moments` Jekyll collection for short narrative fragments, with a CI workflow that syncs documents from a Mnemosyne folder into the collection on a daily schedule (or via manual dispatch). - `_moments/` collection with dedicated `moment` layout and index page - `.github/scripts/sync_from_mnemosyne.py` calls the platform's POST /generate-markdown/folder endpoint, writes synced files, and removes orphaned ones via provenance-block reconciliation - `.github/workflows/deploy.yml` adds a `sync-mnemosyne-folder` job (workflow_dispatch + daily cron at 10:00 UTC) that runs before deploy - `.tool-versions` pins Ruby 3.2.2 to match CI Hand-written moments are never touched by the sync — only files with a `mnemosyne:` frontmatter block are eligible for reconciliation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
A starting point for syncing short narrative fragments from Vera's
Mnemosyne platform into a new Jekyll
_momentscollection on your site.You write fragments in Mnemosyne (in a folder named
moments), and adaily GitHub Actions job exports them as
.mdfiles into_moments/,commits them, and rebuilds the site. Hand-written
.mdfiles in_moments/are never touched by the sync — only Mnemosyne-synced filesare eligible for cleanup.
It's deliberately easy to turn off: delete the
schedule:line indeploy.yml, or remove thesync-mnemosyne-folderjob entirely, andeverything else (the collection, the layout, the index page) keeps
working as a normal hand-written Jekyll collection.
What's added
Jekyll collection
_config.yml— registersmomentscollection with permalink/moments/:path/_layouts/moment.liquid— small layout (optional title, date, tags, content)_pages/moments.md— reverse-chronological index page at/moments/, withnav_order: 6. Open question: do you want this earlier in the nav? See note below._moments/2026-05-13-first-moment.md— a hand-written sample fragment so you can see what the format looks like. Nomnemosyne:provenance block on it, so the sync will never delete it.CI sync
.github/scripts/sync_from_mnemosyne.py— Python script that calls Vera's platform, writes files, and reconciles deletes via provenance blocks. ~360 lines, only depends onpyyaml..github/workflows/deploy.yml— newsync-mnemosyne-folderjob that runs before the existingdeployjob, on either:workflow_dispatch(manual button in the Actions tab), orschedule: cron \"0 10 * * *\"(daily at 10:00 UTC)The synced commit auto-retriggers the
deployjob via the existingpush:path.Ruby pin
.tool-versions— pins Ruby 3.2.2 to match CI. Works withmise(recommended),asdf, orrbenv.How the sync works
Mnemosyne is the platform Vera runs (
mnemosyne-platformrepo). It returns a JSON batch:```json
{
"folder": { "name": "moments", "id": "" },
"items": [{ "document_id": "...", "filename": "YYYY-MM-DD-slug-doc8.md", "content": "<frontmatter + body>" }],
"document_ids": ["", ...],
"warnings": [{ "document_id": "...", "reason": "empty after render" }]
}
```
The script writes each item to
_moments/<filename>, then scans existing files and removes any whosemnemosyne.document_idisn't in the response'sdocument_idslist. Files without amnemosyne:block are always safe.What you need to do to turn it on
github-eigenlucy. Copy the secret immediately — you only see it once.MNEMOSYNE_URL— base URL of the platform, no trailing slash (e.g.https://mnemosyne.dev.sophia-labs.com)MNEMOSYNE_API_KEY— themnemo_…secret from step 2momentsin your Mnemosyne graph (top-level, label exactlymoments)If you'd rather start without the daily cron, delete the
schedule:block indeploy.yml. The workflow_dispatch button still works for manual runs.Safety properties
These are the load-bearing invariants — if any of these are wrong, please flag it:
mnemosyne:provenance block in their YAML frontmatter. Anything you write by hand stays put._<collection>/(default_moments/). Your_posts/,_eigenlucy/, etc. are untouched.workflow_dispatch+ the daily cron.What's been tested locally
/moments/<slug>/mnemosyne:block survived a sync where its filename wasn't in the responsemnemosyne:block got correctly flagged as orphan and removedwarnings, not failuresKnown quirks (not blocking, just FYI)
tiptap_xml_to_markdownconverter has a pre-existing bug where the same paragraph can appear twice in exports. This affects both the new/generate-markdownendpoint and the existing/documents/.../exportendpoint identically. Vera is filing it separately. Probably only triggers for docs created in unusual ways; docs you write in the Mnemosyne editor likely look fine. If you see duplication, that's why.#heading), the filename falls back to a chunk of the document id — e.g.2026-05-13-5ada439e-5ada439e.md. Cosmetic; the page renders fine. Start moments with a heading if you want pretty filenames.momentsfolder), the next sync still deletes its file on the Jekyll side via the orphan logic. That works. But there's no audit trail — the file just disappears. Worth knowing.nav_order: 6for the moments index puts it aftereigenlucyin your nav. If you want it earlier (say, betweenblogandresume), bump the other pages — happy to do that in a follow-up.Companion change
The endpoint lives in
mnemosyne-platformon branchfeature/generate-markdown-jekyll-export. That branch needs to be deployed before this workflow can do anything — until then, the workflow will fail with a connection error, which is fine (it won't break your site).How to revert if needed
The whole sync is contained. To turn it off:
schedule:block from.github/workflows/deploy.yml(or just the cron line). Thedeployjob keeps working._moments/collection is just a Jekyll collection at that point — hand-write files in it like any other collection, or delete it.sync-mnemosyne-folderjob.You don't lose any content — synced files have already been committed to git history, and hand-written files were never touched.
🤖 Generated with Claude Code